Support _keepTypedInAdditionalProperties for UsageSummary models#4427
Open
charlie-zhang109 wants to merge 4 commits into
Open
Support _keepTypedInAdditionalProperties for UsageSummary models#4427charlie-zhang109 wants to merge 4 commits into
charlie-zhang109 wants to merge 4 commits into
Conversation
Add a static `_keepTypedInAdditionalProperties = true` flag to UsageSummaryDate, UsageSummaryDateOrg, and UsageSummaryResponse. Update ObjectSerializer (v1 + v2) to include typed keys in additionalProperties when a model sets this flag, giving a single unified access pattern for all fields. Note: ObjectSerializer is auto-generated; the upstream generator also needs updating to emit the keepAllInAdditional guard for flagged models. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
… mode When _keepTypedInAdditionalProperties is true, known typed attributes are now deserialized with their declared type/format before being stored in additionalProperties. This routes int64 fields through the BigInt conversion path instead of raw JSON number assignment. Also removes the redundant instance.additionalProperties initialization guard that was immediately overwritten. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…ibutesMap pass Previously the keepAllInAdditional path rebuilt a baseNameToAttr reverse map inside the conditional on every deserialization call. Hoisting it to a single combined loop halves the attributesMap iterations per call for flagged models. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
|
…ObjectSerializer
baseNameToAttr was conditionally set to null when keepAllInAdditional is false,
which fails under strict: true. Always initialize to {} and skip population via
the existing keepAllInAdditional guard in the loop body.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What does this PR do?
Adds
static readonly _keepTypedInAdditionalProperties = truetoUsageSummaryDate,UsageSummaryDateOrg, andUsageSummaryResponse(the spec flag comes from DataDog/datadog-api-spec#5941).Updates
ObjectSerializer.ts(v1 + v2) to check this flag during deserialization: when set, ALL JSON keys (not just unknown ones) are included inextraAttributesand therefore inadditionalProperties. Previously, only keys absent fromattributesBaseNamesreached that map.Companion PRs:
Review checklist
This PR includes all newly recorded cassettes for any modified tests.
This PR does not rely on API client schema changes.
Or, this PR relies on API schema changes and this is a Draft PR to include tests for that new functionality.